﻿@model S4Store.Models.SellerReport.SellerDataItemModel
@{
    Layout = null;
    ViewBag.Title = "SellerDataItem"; 
    var container = "div" + Guid.NewGuid().ToString();
}
<div style="width:100%; overflow:auto">
<table>
    <tr>
    <td valign="top">
<div style="margin:20px; text-align:center ">
    @Model.ItemType.ToString()
    @Model.BarModel.Month.ToString("(yyyy-MM)")
</div>
        <table  class="reporttable"  style="border-collapse:collapse;">
            <tr>
                <th  valign="top"><div>销售顾问姓名</div></th>
                <th valign="top"><div>销售顾问职业资质</div></th>
                @foreach (var m in Model.GetViewItems())
                {                    
                <th valign="top"><div>@m</div></th>
                }
            </tr>
            @foreach (var m in Model.SellerPersonReports)
            {
            <tr>                
                <td>@m.Seller.Name</td>
                <td>@(m.Seller.WorkYear)年</td>
                    @foreach (var itemdata in Model.GetItemDatas(m.Seller))
                    {
                        <td @if (itemdata.IsFail != null && itemdata.IsFail.Value)
                            {
                                <text>style="background:red"</text>
                            }>
                        @if (itemdata.IsRate)
                        {
                            @(itemdata.Value.toInt())<text>%</text>
                        }
                        else
                        {
                            @itemdata.Value.toInt()
                        }
                        </td>
                    }
               
                
            </tr>
            }
            <tr>
                <th colspan="2">销售部平均数</th>
                @foreach (var itemdata in Model.GetAvgData())
                    {
                        <td @if (itemdata.IsFail != null && itemdata.IsFail.Value)
                            {
                                <text>style="background:red"</text>
                            }>
                        @if (itemdata.IsRate)
                        {
                            @(itemdata.Value.toInt())<text>%</text>
                        }
                        else
                        {
                            @itemdata.Value.toInt()
                        }
                        </td>
                    }
            </tr>
            <tr>
                <th colspan="2">销售部总数</th>
                @foreach (var itemdata in Model.GetSumData())
                    {
                            
                        <td @if (itemdata.IsFail != null && itemdata.IsFail.Value)
                            {
                                <text>style="background:red"</text>
                            }>
                        @if (itemdata.IsRate)
                        {
                            @(itemdata.Value.toInt())<text>%</text>
                        }
                        else
                        {
                            @itemdata.Value.toInt()
                        }
                        </td>
                    }
                <td></td>
            </tr>
        </table>    
    </td>
    <td valign="top">
 @{
     Model.LineModel.Width = 800;
     Model.LineModel.Height = 300;
 }   
 @Html.Action("ReportBar", "Common", Model.BarModel)
@Html.Partial("../Chart/Line", Model.LineModel)
    </td>
    </tr>
</table>
</div>

